require 'test/unit'

require 'models/item'
require 'database/game_database'

class EntityTemplateTest < Test::Unit::TestCase
    def setup
        tmpl = ItemTemplate.new
        tmpl.name = "Item"
        ItemDatabase.instance.use_templates([tmpl],false)
    end
    def test_item
        tmpl = ItemDatabase.instance.find_template_by_name("Item")
        assert_not_nil(tmpl)

        item = ItemDatabase.instance.generate_from_template(tmpl)
        assert_not_nil(item)

        assert_equal(tmpl,item.template)
        assert_equal(tmpl.name,item.name)
        assert_equal(tmpl.description,item.description)
        assert_not_equal(tmpl,item)
    end
end
